var express = require('express')
var router = require('./router')
var bodyParser = require('body-parser')






var app = express()


var allowCrossDomain = function(req, res, next) {
  res.header('Access-Control-Allow-Origin', 'http://localhost:3000');
  res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
  res.header('Access-Control-Allow-Headers', 'Content-Type');
  res.header('Access-Control-Allow-Credentials','true');
  next();
}
app.use(allowCrossDomain)
app.use('/public',express.static('./public'))



app.use(bodyParser.urlencoded({extended:false}))
app.use(bodyParser.json())
// app.use(bodyParser.json({limit:'100mb'}));
// app.use(bodyParser.urlencoded({ limit:'100mb', extended: true }));

app.use(router) 







app.listen(3001,function(){
  console.log('app is running at port 3001')
})




